package com.kejiguan.ui.dialog;

import android.content.Context;
import android.view.View;

import com.kejiguan.ui.R;
import com.kejiguan.ui.response.AlarmResponse;

/**
 * Created by YYY on 16/7/9.
 */
public class AlarmDialogUtil {


    private static AlarmDialogUtil instance;
    private AlarmDialog alarmDialog;

    public AlarmDialogUtil() {
    }

    public static AlarmDialogUtil getInstance() {
        if (instance == null) {
            synchronized (AlarmDialogUtil.class) {
                if (instance == null) {
                    instance = new AlarmDialogUtil();
                }
            }
        }
        return instance;
    }

    public void show(Context context, AlarmResponse alarmResponse, View.OnClickListener onClickListener, AlarmDialog.OnAlarmDialogDismissListener dialogDismissListener)
    {
        alarmDialog=new AlarmDialog(context, R.style.dialog_tran);
        alarmDialog.withAlarm(alarmResponse).withOnAlarmDialogDismissListener(dialogDismissListener).withOnClick(onClickListener).show();
        alarmDialog.setCanceledOnTouchOutside(true);

    }

    public void dismiss()
    {
        if (null!=alarmDialog&&alarmDialog.isShowing())
        {
            alarmDialog.dismiss();
        }
    }

}
